home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Resources / Partition Logic 0.61 / partlogic-0.61.iso / system / headers / sys / disk.h < prev    next >
C/C++ Source or Header  |  2006-01-31  |  4KB  |  111 lines

  1. // 
  2. //  Visopsys
  3. //  Copyright (C) 1998-2006 J. Andrew McLaughlin
  4. //  
  5. //  This library is free software; you can redistribute it and/or modify it
  6. //  under the terms of the GNU Lesser General Public License as published by
  7. //  the Free Software Foundation; either version 2.1 of the License, or (at
  8. //  your option) any later version.
  9. //
  10. //  This library is distributed in the hope that it will be useful, but
  11. //  WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
  13. //  General Public License for more details.
  14. //
  15. //  You should have received a copy of the GNU Lesser General Public License
  16. //  along with this library; if not, write to the Free Software Foundation,
  17. //  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. //
  19. //  disk.h
  20. //
  21.  
  22. // This file contains definitions and structures for using and manipulating
  23. // disk in Visopsys.
  24.  
  25. #if !defined(_DISK_H)
  26.  
  27. #include <sys/file.h>
  28.  
  29. #define DISK_MAXDEVICES               32
  30. #define DISK_MAX_NAMELENGTH           16
  31. #define DISK_MAX_PARTITIONS           16
  32. #define DISK_MAX_PRIMARY_PARTITIONS   4
  33. #define FSTYPE_MAX_NAMELENGTH         32
  34.  
  35. // Extended partition types
  36. #define PARTITION_TYPEID_EXTD         0x05
  37. #define PARTITION_TYPEID_EXTD_LBA     0x0F
  38. #define PARTITION_TYPEID_EXTD_LINUX   0x85
  39. #define PARTITION_TYPEID_IS_EXTD(x)    \
  40.   ((x == PARTITION_TYPEID_EXTD)     || \
  41.    (x == PARTITION_TYPEID_EXTD_LBA) || \
  42.    (x == PARTITION_TYPEID_EXTD_LINUX))
  43. #define PARTITION_TYPEID_IS_HIDDEN(x)                          \
  44.   ((x == 0x11) || (x == 0x14) || (x == 0x16) || (x == 0x17) || \
  45.    (x == 0x1B) || (x == 0x1C) || (x == 0x1E) || (x == 0x93))
  46. #define PARTITION_TYPEID_IS_HIDEABLE(x)                        \
  47.   ((x == 0x01) || (x == 0x04) || (x == 0x06) || (x == 0x07) || \
  48.    (x == 0x0B) || (x == 0x0C) || (x == 0x0E) || (x == 0x83))
  49.  
  50. // Flags for supported filesystem operations on a partition
  51. #define FS_OP_FORMAT                  0x01
  52. #define FS_OP_CLOBBER                 0x02
  53. #define FS_OP_CHECK                   0x04
  54. #define FS_OP_DEFRAG                  0x08
  55. #define FS_OP_STAT                    0x10
  56. #define FS_OP_RESIZECONST             0x20
  57. #define FS_OP_RESIZE                  0x40
  58.  
  59. // Flags to describe what kind of disk is described by a disk structure
  60. #define DISKFLAG_LOGICAL              0x20000000
  61. #define DISKFLAG_PHYSICAL             0x10000000
  62. #define DISKFLAG_PRIMARY              0x01000000
  63. #define DISKFLAG_LOGICALPHYSICAL      (DISKFLAG_PHYSICAL | DISKFLAG_LOGICAL)
  64. #define DISKFLAG_FIXED                0x00200000
  65. #define DISKFLAG_REMOVABLE            0x00100000
  66. #define DISKFLAG_FIXEDREMOVABLE       (DISKFLAG_FIXED | DISKFLAG_REMOVABLE)
  67. #define DISKFLAG_FLOPPY               0x00000100
  68. #define DISKFLAG_SCSICDROM            0x00000020
  69. #define DISKFLAG_IDECDROM             0x00000010
  70. #define DISKFLAG_CDROM                (DISKFLAG_SCSICDROM | DISKFLAG_IDECDROM)
  71. #define DISKFLAG_SCSIDISK             0x00000002
  72. #define DISKFLAG_IDEDISK              0x00000001
  73. #define DISKFLAG_HARDDISK             (DISKFLAG_SCSIDISK | DISKFLAG_IDEDISK)
  74.  
  75. // This structure is used to describe a known partition type
  76. typedef struct {
  77.   unsigned char code;
  78.   const char description[FSTYPE_MAX_NAMELENGTH];
  79.  
  80. } partitionType;   
  81.  
  82. typedef struct {
  83.   char name[DISK_MAX_NAMELENGTH];
  84.   int deviceNumber;
  85.   int flags;
  86.   partitionType partType;
  87.   char fsType[FSTYPE_MAX_NAMELENGTH];
  88.   unsigned opFlags;
  89.  
  90.   unsigned heads;
  91.   unsigned cylinders;
  92.   unsigned sectorsPerCylinder;
  93.   unsigned sectorSize;
  94.  
  95.   unsigned startSector;
  96.   unsigned numSectors;
  97.  
  98.   // Filesystem related
  99.   unsigned blockSize;
  100.   unsigned freeBytes;
  101.   unsigned minSectors;  // for
  102.   unsigned maxSectors;  // resize
  103.   int mounted;
  104.   char mountPoint[MAX_PATH_LENGTH];
  105.   int readOnly;
  106.  
  107. } disk;
  108.  
  109. #define _DISK_H
  110. #endif
  111.